# ！/home/yang/PythonProjects python
# -*- coding: utf-8 -*-
# author:yang  time:19-7-17 上午11:01


# import random
# num = random.randint(99999, 1000000)
# print(num)

# class Dog(object):
#
#     def __init__(self, name):
#         self.name = name
#
#     def eat(self):
#         print(" %s is eating" % self.name)
#
#
# d = Dog("ChenRonghua")
# d.eat()


# class Parent(object):
#     x = 1
#
#
# class Child1(Parent):
#     pass
#
#
# class Child2(Parent):
#     pass
#
#
# print(Parent.x, Child1.x, Child2.x)
# Child1.x = 2
# print(Parent.x, Child1.x, Child2.x)
# Parent.x = 3
# print(Parent.x, Child1.x, Child2.x)


# a = ['1', '2', '3']
# c = []
# for i in a:
#     c.append(int(i))
# print(c)


# l = []
# for i in range(10):
#     l.append(i)
#     print(l)
# import re
str1 = 'k:1|k1:2|k2:3|k3:4'
# list_key = re.findall(r'(.*?):', str1)
# print(list_key)
# list_value = re.findall(r':(\d+)[|]', str1)
# print(list_value)
# dirt_str = zip(list_key, list_value)
# print(dirt_str)
#
# str_list = str1.split("|")
# # print(str_list)
# str_list_1 = []
# for i in str_list:
#     # print(type(i))
#     str_list_1.append(i.split(":"))
# print(str_list_1)
# list_key = []
# list_value = []
# dict_ = {}
# for i in range(0, len(str_list_1), 1):
#     list_key.append(str_list_1[i][0])
#     list_value.append(str_list_1[i][1])
#
# dict_ = dict(zip(list_key, list_value))
# print(dict_)


# str_list = str1.split('|')
# str_list_1 = [i.split(':') for i in str1.split('|')]

# list_key = [str_list_1[i][0] for i in range(len(str_list_1))]
# list_value = [str_list_1[i][1] for i in range(len(str_list_1))]

print(dict(zip([[i.split(':') for i in str1.split('|')][i][0] for i in range(len([i.split(':') for i in str1.split('|')]))], [[i.split(':') for i in str1.split('|')][i][1] for i in range(len([i.split(':') for i in str1.split('|')]))])))

str1 = 'k:1|k1:2|k2:3|k3:4'

dict_str = {}
for i in str1.split('|'):
    dict_str[i.split(':')[0]] = i.split(':')[1]
print(dict_str)


print('*'*60)


class Dog(object):
    def __init__(self, name):
        self.name = name

    @property
    def eat(self):
        print("%s is eating " % self.name)


d = Dog("ssss")
